﻿Jxstar.currentPage = function() {
	var config = {param:{},initpage:function(page, define){},eventcfg:{}};

	var moneytypeData = Jxstar.findComboData('moneytype');
	var authtypeData = Jxstar.findComboData('authtype');

	var cols = [
	{col:{header:'关注人', width:100, sortable:true}, field:{name:'project_my__user_name',type:'string'}},
	{col:{header:'项目编号', width:100, sortable:true}, field:{name:'project_base__project_code',type:'string'}},
	{col:{header:'项目名称', width:201, sortable:true}, field:{name:'project_base__project_name',type:'string'}},
	{col:{header:'计划批复金额(万元)', width:115, sortable:true, renderer:JxUtil.formatNumber(2)}, field:{name:'project_base__plan_money',type:'float'}},
	{col:{header:'合同金额(万元)', width:100, sortable:true, renderer:JxUtil.formatNumber(2)}, field:{name:'project_base__contract_money',type:'float'}},
	{col:{header:'已付款金额(万元)', width:113, sortable:true, renderer:JxUtil.formatNumber(2)}, field:{name:'project_base__pay_money',type:'float'}},
	{col:{header:'论证完成日期', width:100, sortable:true, renderer:function(value) {
			return value ? value.format('Y-m-d') : '';
		}}, field:{name:'project_base__date_lz',type:'date'}},
	{col:{header:'招投标完成日期', width:100, sortable:true, renderer:function(value) {
			return value ? value.format('Y-m-d') : '';
		}}, field:{name:'project_base__date_ztb',type:'date'}},
	{col:{header:'合同签订日期', width:100, sortable:true, renderer:function(value) {
			return value ? value.format('Y-m-d') : '';
		}}, field:{name:'project_base__date_ht',type:'date'}},
	{col:{header:'实施完成日期', width:100, sortable:true, renderer:function(value) {
			return value ? value.format('Y-m-d') : '';
		}}, field:{name:'project_base__date_done',type:'date'}},
	{col:{header:'内部验收日期', width:100, sortable:true, renderer:function(value) {
			return value ? value.format('Y-m-d') : '';
		}}, field:{name:'project_base__date_yans',type:'date'}},
	{col:{header:'财务决算日期', width:100, sortable:true, renderer:function(value) {
			return value ? value.format('Y-m-d') : '';
		}}, field:{name:'project_base__date_jues',type:'date'}},
	{col:{header:'竣工验收日期', width:100, sortable:true, renderer:function(value) {
			return value ? value.format('Y-m-d') : '';
		}}, field:{name:'project_base__date_check',type:'date'}},
	{col:{header:'项目类别', width:100, sortable:true, align:'center',
		editable:false,
		editor:new Ext.form.ComboBox({
			store: new Ext.data.SimpleStore({
				fields:['value','text'],
				data: moneytypeData
			}),
			emptyText: jx.star.select,
			mode: 'local',
			triggerAction: 'all',
			valueField: 'value',
			displayField: 'text',
			editable:false,
			value: moneytypeData[0][0]
		}),
		renderer:function(value){
			for (var i = 0; i < moneytypeData.length; i++) {
				if (moneytypeData[i][0] == value)
					return moneytypeData[i][1];
			}
		}}, field:{name:'project_base__money_type',type:'string'}},
	{col:{header:'授权形式', width:100, sortable:true, align:'center',
		editable:false,
		editor:new Ext.form.ComboBox({
			store: new Ext.data.SimpleStore({
				fields:['value','text'],
				data: authtypeData
			}),
			emptyText: jx.star.select,
			mode: 'local',
			triggerAction: 'all',
			valueField: 'value',
			displayField: 'text',
			editable:false,
			value: authtypeData[0][0]
		}),
		renderer:function(value){
			for (var i = 0; i < authtypeData.length; i++) {
				if (authtypeData[i][0] == value)
					return authtypeData[i][1];
			}
		}}, field:{name:'project_base__auth_type',type:'string'}},
	{col:{header:'实施单位', width:123, sortable:true}, field:{name:'project_base__dept_name',type:'string'}},
	{col:{header:'项目负责人', width:75, sortable:true}, field:{name:'project_base__project_user',type:'string'}},
	{col:{header:'项目ID', width:100, sortable:true, hidden:true}, field:{name:'project_my__project_id',type:'string'}},
	{col:{header:'主键', width:100, sortable:true, hidden:true}, field:{name:'project_my__my_id',type:'string'}},
	{col:{header:'关注人ID', width:100, sortable:true, hidden:true}, field:{name:'project_my__user_id',type:'string'}},
	{col:{header:'实施单位id', width:100, sortable:true, hidden:true}, field:{name:'project_base__dept_id',type:'string'}},
	{col:{header:'计划批复文号', width:100, sortable:true, hidden:true}, field:{name:'project_base__check_fileno',type:'string'}}
	];
	
	config.param = {
		cols: cols,
		sorts: null,
		hasQuery: '0',
		isedit: '0',
		isshow: '1',
		funid: 'project_my'
	};
	
	//不需要复选模式
	config.param.selectModel = 'row';
	
	cols[0] = {col:
		{header:'<div class="hd_button_add" title="添加我关注的项目">&#160;</div>', id:'col_button_add', width:30, xtype:'actioncolumn', menuDisabled:true, align:'center', items:[{
				icon: 'resources/images/icons/fam/clear.gif',
				tooltip: '取消关注',	
				handler: function(grid, rowIndex, colIndex) {
					grid.getSelectionModel().selectRow(rowIndex);
					grid.gridNode.event.del();
				}
			}]
		}
	};
	
	//把项目名称字段值改为超链接
	var renderTask = function(val, metaData, record) {
		var dataId = record.get('project_my__project_id');
		
		var chgcolor = 'onmouseover="this.style.color=\'#FF4400\';" onmouseout="this.style.color=\'#0080FF\';"';
		var html = '<a href="#" title="打开项目监控功能" style=\'color:#0080FF;\' '+ chgcolor +' onclick="Jxstar.createNode(\'project_monitor\', \''+ dataId +'\');">'+ val +'</a>';
		return html;
	};
	
	cols[2].col.renderer = renderTask;
	
	config.initpage = function(gridNode){
		var grid = gridNode.page;
		grid.on('render', function(){
			Ext.fly(grid.getView().innerHd).on('mousedown', function(e, t){
			//添加表头添加事件
				if(e.button === 0 && t.className == 'hd_button_add'){
					e.stopEvent();
					grid.gridNode.event.dataImport();
				}
			}, grid);
        }, grid);
		
	};
		
	return new Jxstar.GridNode(config);
}